<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>NameError</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/github.css" type="text/css" media="screen" />
<script src="../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
            <span>Ruby on Rails v4.0.0</span><br />
        
        <h1>
            <span class="type">Class</span> 
            NameError 
            
                <span class="parent">&lt; 
                    
                    <a href="Object.html">Object</a>
                    
                </span>
            
        </h1>
        <ul class="files">
            
            <li><a href="../files/activesupport/lib/active_support/core_ext/name_error_rb.html">activesupport/lib/active_support/core_ext/name_error.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  


  


  
  


  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>M</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="NameError.html#method-i-missing_name">missing_name</a>,
              </li>
            
              
              <li>
                <a href="NameError.html#method-i-missing_name-3F">missing_name?</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  



  

    

    

    


    


    <!-- Methods -->
        
      <div class="sectiontitle">Instance Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-missing_name">
            
              <b>missing_name</b>()
            
            <a href="NameError.html#method-i-missing_name" name="method-i-missing_name" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Extract the name of the missing constant from the exception message.</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-missing_name_source')" id="l_method-i-missing_name_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/9acc824d96db039486fc493c6f904035fe386967/activesupport/lib/active_support/core_ext/name_error.rb#L3" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-missing_name_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/name_error.rb, line 3</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">missing_name</span>
  <span class="ruby-keyword">if</span> <span class="ruby-regexp">/undefined local variable or method/</span> <span class="ruby-operator">!~</span> <span class="ruby-identifier">message</span>
    <span class="ruby-node">$1</span> <span class="ruby-keyword">if</span> <span class="ruby-regexp">/((::)?([A-Z]\w*)(::[A-Z]\w*)*)$/</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">message</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-missing_name-3F">
            
              <b>missing_name?</b>(name)
            
            <a href="NameError.html#method-i-missing_name-3F" name="method-i-missing_name-3F" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              <p>Was this exception raised because the given name was missing?</p>
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-missing_name-3F_source')" id="l_method-i-missing_name-3F_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/9acc824d96db039486fc493c6f904035fe386967/activesupport/lib/active_support/core_ext/name_error.rb#L10" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-missing_name-3F_source" class="dyn-source">
                <pre><span class="ruby-comment"># File activesupport/lib/active_support/core_ext/name_error.rb, line 10</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">missing_name?</span>(<span class="ruby-identifier">name</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Symbol</span>
    <span class="ruby-identifier">last_name</span> = (<span class="ruby-identifier">missing_name</span> <span class="ruby-operator">||</span> <span class="ruby-string">''</span>).<span class="ruby-identifier">split</span>(<span class="ruby-string">'::'</span>).<span class="ruby-identifier">last</span>
    <span class="ruby-identifier">last_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">missing_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                    </div>

    </div>
  </body>
</html>    